<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/css/layui.css">
</head>
 <body>
  <div style="width: 800px;margin: 0 auto;position: absolute;left: 5%;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;text-align: center">
        <legend>添加学生成绩</legend>
    </fieldset>

    <form class="layui-form" action="" lay-filter="addStuScore">
        <div class="layui-form-item">
            <label class="layui-form-label">学生学号</label>
            <div class="layui-input-inline">
                <input type="text" name="studentId" lay-verify="required" lay-reqText="请输入正确的学号" placeholder="请输入学号" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">班级</label>
            <div class="layui-input-inline">
                <input type="text" name="classesId" lay-verify="title" autocomplete="off" placeholder="请输入姓名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">科目</label>
            <div class="layui-input-inline">
                <select name="subjectId">
                    <option value="">请选择科目</option>
                    <option value="1">语文</option>
                    <option value="2">数学</option>
                    <option value="3">英语</option>
                    <option value="4">物理</option>
                    <option value="5">化学</option>
                    <option value="6">生物</option>
                    <option value="7">地理</option>
                    <option value="8">历史</option>
                    <option value="9">政治</option>
                    <option value="10">体育</option>
                </select>
            </div>
            <label class="layui-form-label">科目老师</label>
            <div class="layui-input-inline">
                <select name="teacherId">
                    <option value="">请选择科目老师</option>
                    <option value="1">文章</option>
                    <option value="3">数学王者</option>
                    <option value="4">物理大神</option>
                    <option value="5">化学牛人</option>
                    <option value="7">生物教授</option>
                    <option value="9">历史时钟</option>
                    <option value="10">政治角斗士</option>
                    <option value="13">地理游客</option>
                    <option value="15">体育达人</option>
                    <option value="16">英语健将</option>
                    <option value="17">杂家</option>
                    <option value="19">全才</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">分数</label>
            <div class="layui-input-inline">
                <input type="text" name="score"  placeholder="请输入分数" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">考试时间</label>
            <div class="layui-input-inline">
                <input type="date" name="testTime"  placeholder="请输入考试时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <button  class="layui-btn" lay-submit lay-filter="doSubmit">新增</button>
            <input type="reset" class="layui-btn" value="重置">
        </div>
    </form>
  </div>
 </body>
<script src="/layui.js"></script>
<script src="/js/jquery-1.8.3.js"></script>
<script>
    layui.use(["form","layer"],function () {
        let form=layui.form;
        let layer=layui.layer;

        form.on("submit(doSubmit)",function (data) {
            $.post("/teacher/addStuScore",data.field,function (res) {
                if (res.success=="true"){
                    layer.alert("新增成功！",{icon:6,time:2000});
                    setTimeout(function () {
                        layer.closeAll();
                    }, 1000*1.5)
                } else {
                    layer.alert(res.msg,{icon:5,time:2000})
                }

            });
            return false;
        })

    })
</script>
</html>